DEF_PROJECT=../../..
include $(DEF_PROJECT)/scripts/main.mk
name=eglibc
version=2.16
build=eglibc-build
group=tools
srctree=$(source)/libc
deps=gcc-newlib binutils
sysroot=$(DIR_SYSROOT)
prefix=/usr

DL_SERV=svn
DL_HOST=svn.eglibc.org
DL_PATH=branches/$(name)-$(subst .,_,$(version))
DL_SUFFIX=tar.bz2

cdefs+=BUILD_CC=$(addsuffix -,$(CC_BUILD))gcc CC=$(addsuffix -,$(CC_TARGET))gcc
cdefs+=AR=$(addsuffix -,$(CC_TARGET))ar RANLIB=$(addsuffix -,$(CC_TARGET))ranlib

cflags+=--libexecdir=/usr/lib/eglibc
cflags+=--host=$(CC_TARGET)
cflags+=--build=$(CC_BUILD)
cflags+=--disable-profile
cflags+=--enable-add-ons
cflags+=--with-tls
cflags+=--enable-kernel=$(CC_KERNEL)
cflags+=--with-__thread
cflags+=--with-binutils=$(DIR_TOOLS)/bin
cflags+=--with-headers=$(DIR_SYSROOT)/usr/include
cflags+=--cache-file=$(DEF_CONFIG)

pre-build:
	rm -rf $(build)
	mkdir -p $(build)
	cp -n $(source)/Makeconfig{,.orig}
	sed -e 's/ -lgcc_s//' $(source)/Makeconfig.orig > $(source)/Makeconfig
	echo libc_cv_forced_unwind=yes >$(build)/$(DEF_CACHE)
	echo libc_cv_c_cleanup=yes >>$(build)/$(DEF_CACHE)
	echo libc_cv_gnu89_inline=yes >>$(build)/$(DEF_CACHE)
	echo install_root=$(DIR_SYSROOT) >>$(build)/configparms
	cd $(build);$(cdefs) ../$</configure $(cflags)
